<?php

/**
 * AuxNet filter form base class.
 *
 * @package    seth
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseAuxNetFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'plant'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Plant'), 'add_empty' => true)),
      'subplant'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Subplant'), 'add_empty' => true)),
      'type'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AuxNetType'), 'add_empty' => true)),
      'name'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'model'      => new sfWidgetFormFilterInput(),
      'public_ip'  => new sfWidgetFormFilterInput(),
      'private_ip' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'user'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'pass'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'note'       => new sfWidgetFormFilterInput(),
      'pingable'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
    ));

    $this->setValidators(array(
      'plant'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Plant'), 'column' => 'id')),
      'subplant'   => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Subplant'), 'column' => 'id')),
      'type'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('AuxNetType'), 'column' => 'id')),
      'name'       => new sfValidatorPass(array('required' => false)),
      'model'      => new sfValidatorPass(array('required' => false)),
      'public_ip'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'private_ip' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'user'       => new sfValidatorPass(array('required' => false)),
      'pass'       => new sfValidatorPass(array('required' => false)),
      'note'       => new sfValidatorPass(array('required' => false)),
      'pingable'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('aux_net_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'AuxNet';
  }

  public function getFields()
  {
    return array(
      'id'         => 'Number',
      'plant'      => 'ForeignKey',
      'subplant'   => 'ForeignKey',
      'type'       => 'ForeignKey',
      'name'       => 'Text',
      'model'      => 'Text',
      'public_ip'  => 'Number',
      'private_ip' => 'Number',
      'user'       => 'Text',
      'pass'       => 'Text',
      'note'       => 'Text',
      'pingable'   => 'Number',
    );
  }
}
